#!/bin/sh
#
# This is the script for generating files for a specific Dalton test job.
#
# For the .check file ksh or bash is preferred, otherwise use sh
# (and hope it is not the old Bourne shell, which will not work)
#
if [ -x /bin/ksh ]; then
   CHECK_SHELL='#!/bin/ksh'
elif [ -x /bin/bash ]; then
   CHECK_SHELL='#!/bin/bash'
else
   CHECK_SHELL='#!/bin/sh'
fi


#######################################################################
#  TEST DESCRIPTION
#######################################################################
cat > walk_modeflw.info <<'%EOF%'
   walk_modeflw
   ------------
   Molecule:         NH3
   Wave Function:    SCF / 6-31G** (Atombasis)
   Test Purpose:     Locating a transition state using mode following
%EOF%

#######################################################################
#  MOLECULE INPUT
#######################################################################
cat > walk_modeflw.mol <<'%EOF%'
ATOMBASIS
Location of saddle point (transition state) by following
a specific eigenmode
Nosymmetry Atomtypes=2 Cartesian
Charge=7.0 Atoms=1      Basis=6-31G**
N          -.2402098951            -.0000003109             .5147128871
Atoms=3 Charge=1.0      Basis=6-31G**
H          1.4837091636             .0000000802            -.2633317998
H         -1.1558499044            1.5260201343            -.1256905028
H         -1.1558492311           -1.5260211423            -.1256905447
%EOF%

#######################################################################
#  DALTON INPUT
#######################################################################
cat > walk_modeflw.dal <<'%EOF%'
**DALTON INPUT
.WALK
*WALK
.INDEX
  1
.MODFOL
.MODE
 -1
**WAVE FUNCTION
.HF
*SCF INPUT
.THRESH
1.0d-6
**PROPERTIES
.VIBANA
.POPANA
**END OF DALTON INPUT
%EOF%
#######################################################################



#######################################################################

#######################################################################
#  CHECK SCRIPT
#######################################################################
echo $CHECK_SHELL >walk_modeflw.check
cat >>walk_modeflw.check <<'%EOF%'
log=$1

if [ `uname` = Linux ]; then
   GREP="egrep -a"
else
   GREP="egrep"
fi

# WALK module
CRIT1=`$GREP "Commencing geometry optimization based on \.WALK" $log | wc -l`
TEST[1]=`expr	$CRIT1`
CTRL[1]=1
ERROR[1]="WALK MODULE NOT USED"

# Atombasis
CRIT1=`$GREP "N * 1 * 7\.0000 * 28 * 15 * \[10s4p1d\|3s2p1d\]" $log | wc -l`
CRIT2=`$GREP "H * 3 * 1\.0000 * 7 * 5 * \[4s1p\|2s1p\]" $log | wc -l`
CRIT3=`$GREP "total\: * 4 * 10\.0000 * 49 * 30" $log | wc -l`
TEST[2]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3`
CTRL[2]=3
ERROR[2]="ATOMBASIS NOT READ CORRECTLY"

# Cartesian functions
CRIT1=`$GREP "Cartesian basis used" $log | wc -l`
TEST[3]=`expr	$CRIT1`
CTRL[3]=1
ERROR[3]="CARTESIAN BASIS FUNCTIONS NOT USED"

# Geometry
CRIT1=`$GREP "Total number of coordinates\: * 12" $log | wc -l`
CRIT2=`$GREP "1 * x * (\-0|\-)\.2402098951" $log | wc -l`
CRIT3=`$GREP "2 * y * (\-0|\-)\.0000003109" $log | wc -l`
CRIT4=`$GREP "3 * z * (0| )\.5147128871" $log | wc -l`
CRIT5=`$GREP "4 * x * 1\.4837091636" $log | wc -l`
CRIT6=`$GREP "5 * y * (0| )\.0000000802" $log | wc -l`
CRIT7=`$GREP "6 * z * (\-0|\-)\.2633317998" $log | wc -l`
CRIT8=`$GREP "7 * x * \-1\.1558499044" $log | wc -l`
CRIT9=`$GREP "8 * y * 1\.5260201343" $log | wc -l`
CRIT10=`$GREP "9 * z * (\-0|\-)\.1256905028" $log | wc -l`
CRIT11=`$GREP "10 * x * \-1\.1558492311" $log | wc -l`
CRIT12=`$GREP "11 * y * \-1\.5260211423" $log | wc -l`
CRIT13=`$GREP "12 * z * (\-0|\-)\.1256905447" $log | wc -l`
TEST[4]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4 \+ $CRIT5 \+ $CRIT6 \+ \
		$CRIT7 \+ $CRIT8 \+ $CRIT9 \+ $CRIT10 \+ $CRIT11 \+ $CRIT12 \+ \
		$CRIT13`
CTRL[4]=13
ERROR[4]="MOLECULAR GEOMETRY NOT READ CORRECTLY"

# Initial energy
CRIT1=`$GREP "Final * HF energy\: * \-56\.1955447526(3|4)." $log | wc -l`
TEST[5]=`expr	$CRIT1`
CTRL[5]=1
ERROR[5]="INITIAL ENERGY NOT CORRECT"

# Optimization setup
CRIT1=`$GREP "Walk type\: Level\-shifted Newton walk \(mode following\)" $log | wc -l`
CRIT2=`$GREP "Index of critical point searched\: 1" $log | wc -l`
CRIT3=`$GREP "Hessian mode selection \: * \-1" $log | wc -l`
TEST[6]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3`
CTRL[6]=3
ERROR[6]="GEOMETRY OPTIMIZATION NOT SET UP CORRECTLY"

# Initial gradient
CRIT1=`$GREP "N * (0| )\.000000.... * (\-0|\-|0| )\.000000.... * (0| )\.000003...." $log | wc -l`
CRIT2=`$GREP "H * (0| )\.000000.... * (\-0|\-|0| )\.000000.... * (\-0|\-)\.00000[01]...." $log | wc -l`
CRIT3=`$GREP "H * (\-0|\-)\.000000.... * (0| )\.000000.... * (\-0|\-)\.000001...." $log | wc -l`
CRIT4=`$GREP "H * (\-0|\-)\.000000.... * (\-0|\-)\.000000.... * (\-0|\-)\.000001...." $log | wc -l`
TEST[7]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4`
CTRL[7]=4
ERROR[7]="INITIAL GRADIENT NOT CORRECT"

# Initial Hessian
CRIT1=`$GREP "N * x * (0| )\.74534." $log | wc -l`
CRIT2=`$GREP "N * y * (\-0|\-|0| )\.00000(0|1) * (0| )\.74669." $log | wc -l`
CRIT3=`$GREP "N * z * (\-0|\-)\.02598. * (\-0|\-|0| )\.000000 * (0| )\.24846." $log | wc -l`
CRIT4=`$GREP "H * x * (\-0|\-)\.40635. * (\-0|\-|0| )\.00000. * (0| )\.14932. * (0| )\.4436(3|4)." $log | wc -l`
CRIT5=`$GREP "H * y * (\-0|\-|0| )\.00000. * (\-0|\-)\.07353. * (\-0|\-|0| )\.000000 * (0| )\.00000. * (0| )\.06926." $log | wc -l`
CRIT6=`$GREP "H * z * (0| )\.21103. * (\-0|\-|0| )\.000000 * (\-0|\-)\.10028. * (\-0|\-)\.17352. * (\-0|\-|0| )\.000000 * (0| )\.09503." $log | wc -l`
CRIT7=`$GREP "H * x * (\-0|\-)\.16949. * (0| )\.16042. * (\-0|\-)\.06167. * (\-0|\-)\.0186(3|4). * (0| )\.0378(3|4). * (\-0|\-)\.01875." $log | wc -l`
CRIT8=`$GREP "H * y * (0| )\.15763. * (\-0|\-)\.33658. * (0| )\.10662. * (\-0|\-)\.00339. * (0| )\.00213. * (0| )\.00143." $log | wc -l`
CRIT9=`$GREP "H * z * (\-0|\-)\.09252. * (0| )\.15999. * (\-0|\-)\.07409. * (0| )\.01209. * (\-0|\-)\.01855. * (0| )\.00262." $log | wc -l`
CRIT10=`$GREP "H * x * (\-0|\-)\.16949. * (\-0|\-)\.16042. * (\-0|\-)\.06167. * (\-0|\-)\.01864. * (\-0|\-)\.03784. * (\-0|\-)\.01875." $log | wc -l`
CRIT11=`$GREP "H * y * (\-0|\-)\.15763. * (\-0|\-)\.33658. * (\-0|\-)\.10662. * (0| )\.00339. * (0| )\.00213. * (\-0|\-)\.00143." $log | wc -l`
CRIT12=`$GREP "H * z * (\-0|\-)\.09252. * (\-0|\-)\.15999. * (\-0|\-)\.07409. * (0| )\.01209. * (0| )\.01855. * (0| )\.00262." $log | wc -l`
CRIT13=`$GREP "H * x * (0| )\.1749(1|2)." $log | wc -l`
CRIT14=`$GREP "H * y * (\-0|\-)\.17625. * (0| )\.36287." $log | wc -l`
CRIT15=`$GREP "H * z * (0| )\.07216. * (\-0|\-)\.12475. * (0| )\.07014." $log | wc -l`
CRIT16=`$GREP "H * x * (0| )\.01321. * (0| )\.02201. * (0| )\.00826. * (0| )\.17492." $log | wc -l`
CRIT17=`$GREP "H * y * (\-0|\-)\.0220(0|1). * (\-0|\-)\.02843. * (\-0|\-)\.01669. * (0| )\.17625. * (0| )\.36287." $log | wc -l`
CRIT18=`$GREP "H * z * (0| )\.0082(5|6). * (0| )\.01669. * (0| )\.00132. * (0| )\.07216. * (0| )\.12475. * (0| )\.07014." $log | wc -l`
TEST[8]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4 \+ $CRIT5 \+ $CRIT6 \+ \
		$CRIT7 \+ $CRIT8 \+ $CRIT9 \+ $CRIT10 \+ $CRIT11 \+ $CRIT12 \+ \
		$CRIT13 \+ $CRIT14 \+ $CRIT15 \+ $CRIT16 \+ $CRIT17 \+ $CRIT18`
CTRL[8]=18
ERROR[8]="INITIAL HESSIAN NOT CORRECT"

# Initial step
CRIT1=`$GREP "N * \-0*\.010744.... * 0*\.00000(0|1).... * \-0*\.206057...." $log | wc -l`
CRIT2=`$GREP "H * 0*\.1086(89|90).... * \-0*\.00000(1|2).... * 0*\.063205...." $log | wc -l`
CRIT3=`$GREP "H * \-0*\.04897..... * 0*\.09114..... * 0*\.07142(5|6)...." $log | wc -l`
CRIT4=`$GREP "H * \-0*\.04897..... * \-0*\.09114..... * 0*\.07142(5|6)...." $log | wc -l`
TEST[9]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4`
CTRL[9]=4
ERROR[9]="INITIAL STEP NOT CORRECT"

# Second energy
CRIT1=`$GREP "Final * HF energy\: * \-56\.19077736...." $log | wc -l`
TEST[10]=`expr	$CRIT1`
CTRL[10]=1
ERROR[10]="SECOND ENERGY NOT CORRECT"

# Second gradient
CRIT1=`$GREP "N * \-0*\.000460.... *   0*\.000000.... * \-0*\.00883....." $log | wc -l`
CRIT2=`$GREP "H *   0*\.02048[34].... * \-0*\.000000.... *   0*\.001885...." $log | wc -l`
CRIT3=`$GREP "H * \-0*\.010011.... *   0*\.017630.... *   0*\.003475...." $log | wc -l`
CRIT4=`$GREP "H * \-0*\.010011.... * \-0*\.017630.... *   0*\.003475...." $log | wc -l`
TEST[11]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4`
CTRL[11]=4
ERROR[11]="SECOND GRADIENT NOT CORRECT"

# Second Hessian
CRIT1=`$GREP "N * x * 0*\.7894.." $log | wc -l`
CRIT2=`$GREP "N * y * \-*0*\.0000.. * 0*\.7913.." $log | wc -l`
CRIT3=`$GREP "N * z * \-0*\.0373.. * 0*\.0000.. * 0*\.0758.." $log | wc -l`
CRIT4=`$GREP "H * x * \-0*\.4300.. * \-*0*\.0000.. * 0*\.0993.. * 0*\.4524.." $log | wc -l`
CRIT5=`$GREP "H * y * \-*0*\.0000.. * \-0*\.0860.. * \-*0*\.0000.. * \-*0*\.0000.. * 0*\.0753.." $log | wc -l`
CRIT6=`$GREP "H * z * 0*\.1407.. * \-*0*\.0000.. * \-0*\.0360.. * \-0*\.1139.. * \-*0*\.0000.. * 0*\.0438.." $log | wc -l`
CRIT7=`$GREP "H * x * \-0*\.1796.. * 0*\.1590.. * \-0*\.0310.. * \-0*\.0111.. * 0*\.0334.. * \-0*\.0133.." $log | wc -l`
CRIT8=`$GREP "H * y * 0*\.1572.. * \-0*\.3526.. * 0*\.0596.. * \-0*\.0060.. * 0*\.0053.. * 0*\.0003.." $log | wc -l`
CRIT9=`$GREP "H * z * \-0*\.0517.. * 0*\.0954.. * \-0*\.0198.. * 0*\.0073.. * \-0*\.0136.. * \-0*\.0038.." $log | wc -l`
CRIT10=`$GREP "H * x * \-0*\.1796.. * \-0*\.1590.. * \-0*\.0310.. * \-0*\.0111.. * \-0*\.0334.. * \-0*\.0133.." $log | wc -l`
CRIT11=`$GREP "H * y * \-0*\.1572.. * \-0*\.3526.. * \-0*\.0596.. * 0*\.0060.. * 0*\.0053.. * \-0*\.0003.." $log | wc -l`
CRIT12=`$GREP "H * z * \-0*\.0517.. * \-0*\.0954.. * \-0*\.0198.. * 0*\.0073.. * 0*\.0136.. * \-0*\.0038.." $log | wc -l`
CRIT13=`$GREP "H * x * 0*\.1767.." $log | wc -l`
CRIT14=`$GREP "H * y * \-0*\.1718.. * 0*\.3662.." $log | wc -l`
CRIT15=`$GREP "H * z * 0*\.0385.. * \-0*\.0708.. * 0*\.0286.." $log | wc -l`
CRIT16=`$GREP "H * x * 0*\.0141.. * 0*\.0207.. * 0*\.0058.. * 0*\.1767.." $log | wc -l`
CRIT17=`$GREP "H * y * \-0*\.0207.. * \-0*\.0189.. * \-0*\.0108.. * 0*\.1718.. * 0*\.3662.." $log | wc -l`
CRIT18=`$GREP "H * z * 0*\.0058.. * 0*\.0108.. * \-0*\.0048.. * 0*\.0385.. * 0*\.0708.. * 0*\.0286.." $log | wc -l`
TEST[12]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4 \+ $CRIT5 \+ $CRIT6 \+ \
		$CRIT7 \+ $CRIT8 \+ $CRIT9 \+ $CRIT10 \+ $CRIT11 \+ $CRIT12 \+ \
		$CRIT13 \+ $CRIT14 \+ $CRIT15 \+ $CRIT16 \+ $CRIT17 \+ $CRIT18`
CTRL[12]=18
ERROR[12]="SECOND HESSIAN NOT CORRECT"

# Third energy
CRIT1=`$GREP "Final * HF energy\: * \-56\.1857348(7|8|9)...." $log | wc -l`
TEST[13]=`expr	$CRIT1`
CTRL[13]=1
ERROR[13]="THIRD ENERGY NOT CORRECT"

# Final energy
CRIT1=`$GREP "\@ * Energy at current point\: * \-56\.186762439." $log | wc -l`
TEST[14]=`expr	$CRIT1`
CTRL[14]=1
ERROR[14]="FINAL ENERGY NOT CORRECT"

# Convergence
CRIT1=`$GREP "\@ * Geometry optimization has converged\." $log | wc -l`
TEST[15]=`expr	$CRIT1`
CTRL[15]=1
ERROR[15]="GEOMETRY OPTIMIZATION NOT CONVERGED"

# Final gradient and Hessian eigenvalues
CRIT1=`$GREP "\@ 1 * 1 * 0*\.00000(1|2).... * \-0*\.10375....." $log | wc -l`
CRIT2=`$GREP "\@ 1 * 2 * \-*0*\.000000.... * 0*\.1578[34]....." $log | wc -l`
CRIT3=`$GREP "\@ 1 * 3 * \-*0*\.000000.... * 0*\.15784....." $log | wc -l`
CRIT4=`$GREP "\@ 1 * 4 * \-*0*\.000007.... * 0*\.56255....." $log | wc -l`
CRIT5=`$GREP "\@ 1 * 5 * \-*0*\.000000.... * 1*\.47295....." $log | wc -l`
CRIT6=`$GREP "\@ 1 * 6 * \-*0*\.000000.... * 1*\.47295....." $log | wc -l`
TEST[16]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4 \+ $CRIT5 \+ $CRIT6`
CTRL[16]=6
ERROR[16]="FINAL GRADIENT AND HESSIAN EIGENVALUES NOT CORRECT"

# Final geometry
CRIT1=`$GREP "N * \-0\.26705..... * \-0\.000000.... * \-0*\.00001....." $log | wc -l`
CRIT2=`$GREP "H *   1\.59470..... *   0\.000000.... * \-0*\.09707(7|8)...." $log | wc -l`
CRIT3=`$GREP "H * \-1\.19792..... *   1\.614519.... * 0*\.04854(5|6)...." $log | wc -l`
CRIT4=`$GREP "H * \-1\.19792..... * \-1\.614520.... * 0*\.04854(5|6)...." $log | wc -l`
TEST[17]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4`
CTRL[17]=16
ERROR[17]="FINAL GEOMETRY NOT CORRECT"

# Final analysis
CRIT1=`$GREP "Vibrational analysis" $log | wc -l`
CRIT2=`$GREP "Cioslowski population analysis and static polarizabilities only\." $log | wc -l`
TEST[18]=`expr	$CRIT1 \+ $CRIT2`
CTRL[18]=3
ERROR[18]="FINAL ANALYSIS NOT SET UP CORRECTLY"

# Dipole moment gradient
 CRIT1=`$GREP "N * x * \-0*\.467300.. * \-*0*\.000000.. * \-0*\.039172.." $log | wc -l`
 CRIT2=`$GREP "N * y * \-*0*\.000000.. * \-0*\.465258.. * \-*0*\.000000.." $log | wc -l`
 CRIT3=`$GREP "N * z * \-0*\.039172.. * \-*0*\.000000.. * \-1\.216468.." $log | wc -l`
 CRIT4=`$GREP "H * x * 0*\.152099.. * \-*0*\.000000.. * 0*\.013246.." $log | wc -l`
 CRIT5=`$GREP "H * y * \-*0*\.000000.. * 0*\.158763.. * \-*0*\.000000.." $log | wc -l`
 CRIT6=`$GREP "H * z * 0*\.01324(3|4).. * \-*0*\.000000.. * 0*\.405479.." $log | wc -l`
 CRIT7=`$GREP "H * x * 0*\.157600.. * 0*\.003180.. * 0*\.01296(2|3).." $log | wc -l`
 CRIT8=`$GREP "H * y * 0*\.003180.. * 0*\.153247.. * \-0*\.00016(7|8).." $log | wc -l`
 CRIT9=`$GREP "H * z * 0*\.01296(3|4).. * \-0*\.0001(69|70).. * 0*\.405494.." $log | wc -l`
CRIT10=`$GREP "H * x * 0*\.157600.. * \-0*\.003180.. * 0*\.01296(2|3).." $log | wc -l`
CRIT11=`$GREP "H * y * \-0*\.003180.. * 0*\.153247.. * 0*\.00016(7|8).." $log | wc -l`
CRIT12=`$GREP "H * z * 0*\.01296(3|4).. * 0*\.0001(69|70).. * 0*\.405494.." $log | wc -l`
TEST[19]=`expr $CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4 \+ $CRIT5 \+ $CRIT6 \+ \
               $CRIT7 \+ $CRIT8 \+ $CRIT9 \+ $CRIT10 \+ $CRIT11 \+ $CRIT12`
CTRL[19]=12
ERROR[19]="DIPOLE MOMENT GRADIENT NOT CORRECT"

# Cioslowski charges
CRIT1=`$GREP "N * (\-0|\-)\.71634." $log | wc -l`
CRIT2=`$GREP "H * (0| )\.23878." $log | wc -l`
TEST[20]=`expr	$CRIT1 \+ $CRIT2`
CTRL[20]=4
ERROR[20]="CIOSLOWSKI CHARGES NOT CORRECT"

# Static polarizabilities
CRIT1=`$GREP "Ex * 8\.46766. * \-*0*\.000000 * (\-0|\-)\.22596." $log | wc -l`
CRIT2=`$GREP "Ey * \-*0*\.000000 * 8\.47944. * \-*0*\.00000." $log | wc -l`
CRIT3=`$GREP "Ez * (\-0|\-)\.22596. * \-*0*\.00000. * 4\.14608." $log | wc -l`
TEST[21]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3`
CTRL[21]=3
ERROR[21]="STATIC POLARIZABILITIES NOT CORRECT"

# Rotational constants
CRIT1=`$GREP "343489\..... * 343489\..... * 171744\..... MHz" $log | wc -l`
CRIT2=`$GREP "11\.4575.. * 11\.4575.. * 5\.7287.. cm\-1" $log | wc -l`
TEST[22]=`expr	$CRIT1 \+ $CRIT2`
CTRL[22]=2
ERROR[22]="ROTATIONAL CONSTANTS NOT CORRECT"

# Vibrational frequencies
CRIT1=`$GREP "1 * A * 4065\.9. * (0| )\.01852. * 43\.34. * 1\.025." $log | wc -l`
CRIT2=`$GREP "2 * A * 4065\.9. * (0| )\.01852. * 43\.34. * 1\.025." $log | wc -l`
CRIT3=`$GREP "3 * A * 3840\.5. * (0| )\.01749. * (0| )\.000 * (0| )\.0000" $log | wc -l`
CRIT4=`$GREP "4 * A * 1714\.(2|3). * (0| )\.00781. * 41\.55. * (0| )\.983." $log | wc -l`
CRIT5=`$GREP "5 * A * 1714\.(2|3). * (0| )\.00781. * 41\.55. * (0| )\.983." $log | wc -l`
CRIT6=`$GREP "6 * A * 909\.3.i * (0| )\.00414.i" $log | wc -l`
TEST[23]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4 \+ $CRIT5 \+ $CRIT6`
CTRL[23]=6
ERROR[23]="VIBRATIONAL FREQUENCIES NOT CORRECT"

# Partition function
CRIT1=`$GREP "50\.00 * 3\.180.(D|E)\+04 * 13\.9. * 1\.0000 * 4\.44244.(D|E)\+05" $log | wc -l`
CRIT2=`$GREP "200\.00 * 1\.017.(D|E)\+06 * 107\.3. * 1\.0000 * 1\.09284.(D|E)\+08" $log | wc -l`
CRIT3=`$GREP "273\.15 * 2\.218.(D|E)\+06 * 170\.7. * 1\.000. * 3\.78935.(D|E)\+08" $log | wc -l`
CRIT4=`$GREP "298\.15 * 2\.761.(D|E)\+06 * 194\.5. * 1\.000. * 5\.37594.(D|E)\+08" $log | wc -l`
CRIT5=`$GREP "500\.00 * 1\.005.(D|E)\+07 * 421\.0. * 1\.014. * 4\.29600.(D|E)\+09" $log | wc -l`
CRIT6=`$GREP "2000\.00 * 3\.218.(D|E)\+08 * 3354\.2. * 2\.373. * 2\.56(19|20)..(D|E)\+12" $log | wc -l`
TEST[24]=`expr	$CRIT1 \+ $CRIT2 \+ $CRIT3 \+ $CRIT4 \+ $CRIT5 \+ $CRIT6`
CTRL[24]=6
ERROR[24]="MOLECULAR PARTITION FUNCTION NOT CORRECT"

PASSED=1
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
do
   if [ ${TEST[i]} -ne ${CTRL[i]} ]; then
     echo "${ERROR[i]} ( test = ${TEST[i]}; control = ${CTRL[i]} ); "
     PASSED=0
   fi
done

if [ $PASSED -eq 1 ]
then
  echo TEST ENDED PROPERLY
  exit 0
else
  echo THERE IS A PROBLEM
  exit 1
fi

%EOF%
#######################################################################
